<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
		<script>
			function fun(){
				if (confirm("你确定要跳转到百度吗？")) {
					window.location.href = "https://www.baidu.com";
				}				
			}
			function fun2(){
				var url = prompt("请输入你要跳转的网址:");
				console.log(url);
				window.location.href = url;
			}
		</script>
	</head>
	<body>
		<a href="#" onclick="fun()">跳转到百度</a>
		<button onclick="fun2()">自定义跳转</button>
	</body>
</html>
